Thực đơn
Grunt (phần mềm) Ví dụĐây là một ví dụ về một Gruntfile được viết để cho thấy làm thế nào có thể tải plugin, tạo nhiệm vụ và cấu hình chúng:
module.exports = function(grunt) { // Task configuration grunt.initConfig({ taskName1: 'Task1 Configuration', taskName2: 'Task2 Configuration' }); // Loads plugins grunt.loadNpmTasks('pluginName1'); grunt.loadNpmTasks('pluginName2'); // Custom tasks grunt.registerTask('customTaskName1', 'Custom task description', function(taskParameter) { // Custom statements }); // Combining multiple tasks to a single task grunt.registerTask('customTaskName2', ['taskName1,customTaskName1']); // Default task - runs if task name is not specified grunt.registerTask('default', ['customTaskName2']);};
Trong ví dụ trên, thực hiện lệnh grunt
sẽ chạy <customtaskName2>
, lệnh này đã được xác định như là một sự kết hợp của <taskName1>
và <customTaskName1>
.
Thực đơn
Grunt (phần mềm) Ví dụLiên quan
Tài liệu tham khảo
WikiPedia: Grunt (phần mềm) http://gruntjs.com/ https://bocoup.com/weblog/introducing-grunt https://github.com/gruntjs/grunt https://github.com/gruntjs/grunt/blob/master/CHANG... https://www.npmjs.com/package/grunt https://www.wikidata.org/wiki/Q24576808#P1324